#include<bits/stdc++.h>
using namespace std;
int n,q,x,y,zt,a[8005];
int zhao(int x){
	int num=0;
	for(int i=1;i<x;i++){
		if(a[i]<=a[x]) num++; 
	}
	for(int i=x+1;i<=n;i++){
		if(a[i]<a[x]) num++;
	}
	return num+1;
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=q;i++){
		scanf("%d",&zt);
		if(zt==1){
			scanf("%d%d",&x,&y);
			a[x]=y;
		}
		if(zt==2){
			scanf("%d",&x);
			printf("%d\n",zhao(x));
		}
	}
	return 0;
}
